<template>
    <view class="content">
        <template v-if="orderInfo.orderType == 0 && Number(orderStatus) !== 4">
            <view class="bottom pageBottomBtnArea" v-if="Number(orderStatus) !== 4">
                <view class="service-o-icon">
                    <img src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/my/kefu.png" alt="">
                </view>
                <view style="display: flex;justify-content: space-between; width: calc(100% - 196rpx );">
                    <button type="default" plain style="margin: 0px;" class="grayBtn" @click="onApply()" v-if="Number(orderStatus)==1|| Number(orderStatus) == 10">申请售后</button>
                    <button type="default" plain style="margin: 0px;" class="grayBtn" @click="cancelBtn" v-if="Number(orderStatus)==0">取消订单</button>
                    <button type="default" plain style="margin: 0px;" class="grayBtn" @click="delBtn" v-if="Number(orderStatus)==5">删除订单</button>
                    <button plain type="waring" class="orangeBtn" @click="addToCart">再来一单</button>
                </view>
            </view>
        </template>
        <template v-if="orderInfo.orderType == 1 && Number(orderStatus) !== 4">
            <view class="bottom pageBottomBtnArea" v-if="Number(orderStatus) !==4" >
                <view class="service-o-icon"> <img src="https://17lelife-bucket.oss-cn-beijing.aliyuncs.com/WeChat-App-Picture/my/kefu.png" alt=""> </view>
                <view class="pageBottomBtnArea_btn" style="width: calc(100% - 196rpx );">
                    <button type="default" plain style="margin: 0px;" class="grayBtn" @click="submitApply" v-if="params.status=='待使用' || Number(orderStatus) == 6">申请售后</button>
                    <button type="default" plain style="margin: 0px;" class="grayBtn" @click="deleteOrder" v-if="Number(orderStatus) !== 6">删除订单</button>
                    <button plain type="waring" class="orangeBtn" :class="{'fr':Number(orderStatus) !== 6}"  @click="submitAnotherOrder">再来一单</button>
                </view>
            </view>
        </template>
        <!-- 待付款 -->
        <view class="bottom bottomBtnArea pageBottomBtnArea" v-if="Number(orderStatus) == 4" style="height: 144rpx;">
            <button type="default" plain style="margin: 0px; padding: 0 34rpx;" class="button" @click="cancelBtn">取消订单</button>
            <view class="checkoutBtn" :class="{ disabled: isTimeout }" @click="toPayment">付款 <text style="margin-left: 10px;">{{ formatRemainingTime }}</text> </view>
        </view>
        
    </view>
</template>

<script>
import Toast from '@/wxcomponents/vant/toast/toast'

export default {
    props: {
        orderInfo: {
            type: Object,
            default: () => {}
        },
        orderStatus: {
            type: String,
            default: () => ''
        },
        currentIndex: {
            type: Number,
            default: () => 0
        },
    },
    data () {
        return {

        }
    },

    computed: {
    },


    watch: {

    },
    onLoad () {

    },
    onReady () {

    },

    methods: {
        copytext (text) {
            // if (text !== null) {
            //   this.copyNum(text)
            // } else {
            //   this.$message.warning('内容为空，复制失败！')
            // }
            var that = this
            wx.setClipboardData({
                data: text,
                success: function (res) {
                    wx.showToast({
                        title: '复制成功',
                        icon: 'success',
                        duration: 2000
                    })
                }
            })
        },

  },

}
</script>
<style lang="scss" scoped>
// 黑字黑框按钮
.blackBlackBtn {
    background-color: #Ffffff;
    border-radius: 38px;
    font-size: 28rpx;
    text-align: center;
    color: #111111;
    height: 60rpx;
    line-height: 58rpx;
    border: 1rpx solid #111111;
    padding-left: 10px;
    padding-right: 10px;
}
// 已付款的其他状态按钮区域
.pageBottomBtnArea{
  padding-top: 48rpx;
  padding-bottom: calc(48rpx + env(safe-area-inset-bottom));
  background: #ffffff; 
  display: flex;
  align-items: center;
  justify-content: space-between;
}
  // 未付款页面底部的按钮
  .bottomBtnArea {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #f9f9f9;
    background-color: #ffffff;
    padding-bottom: 20px;
    padding-left: 24px;
    padding-right: 24px;
    width: calc(100% - 48px);
  }
  // 付款按钮
  .checkoutBtn {
    background-color: #FF6203;
    border-radius: 38px;
    font-size: 28rpx;
    text-align: center;
    color: #FFFFFF;
    height: 62rpx;
    line-height: 60rpx;
    padding-left: 50px;
    padding-right: 50px;
  }

  .button {
    background-color: #Ffffff;
    border-radius: 38px;
    font-size: 28rpx;
    text-align: center;
    color: #111111;
    height: 62rpx;
    line-height: 60rpx;
    border: 1px solid #D4D4D4 !important;
    padding-left: 10px;
    padding-right: 10px;
    margin-right: 12px;
  }

  .checkBtn {
    border: 1px solid #FF6203 !important;
    background-color: transparent;
    /* width: 100%; */
    border-radius: 38px;
    font-size: 28rpx;
    text-align: center;
    color: #FF6203 !important;
    height: 62rpx;
    line-height: 60rpx;
    padding-left: 13px;
    padding-right: 13px;
  }

  button {
    border: none;
  }

.bottom{
  border-top: 1px solid #f9f9f9;
}
.service-o-icon {
    width: 96rpx;
    height: 62rpx;
    display: flex;
    justify-content: center;
    align-items: center;

// padding-left: 24rpx;
img {
    width: 45rpx;
    height: 45rpx;
}

}

::v-deep .service-o-icon .van-icon {
    font-size: 44rpx !important;
    color: #000000 !important;
}
</style>

